package com.unicom.si.security;

import org.springframework.jdbc.object.MappingSqlQuery;

import javax.sql.DataSource;
import java.sql.ResultSet;
import java.sql.SQLException;

public class ResourceMapping extends MappingSqlQuery {

    public ResourceMapping(DataSource dataSource, String resourceQuery) {
        super(dataSource,resourceQuery);
        compile();
    }

    //对结果集进行封装
    protected Object mapRow(ResultSet resultSet, int i) throws SQLException {

        String url = resultSet.getString(1);
        String role = resultSet.getString(2);
        Resources resc = new Resources(url, role);

        return resc;
    }
}
